/**
 * 
 */
package pl.kaczanowscy.tomek.ipdl.strategy;

import pl.kaczanowscy.tomek.ipdl.RoundResult;
import pl.kaczanowscy.tomek.ipdl.Strategy;
import pl.kaczanowscy.tomek.ipdl.enums.Move;

/**
 * TFT - Tit for Tat.
 * 
 * @author Tomek Kaczanowski
 * 
 */
public final class TFT implements Strategy {

	private Move opponentsLastMove = Move.COOPERATION;

	/**
	 * TFT returns move that opponent used in the previous round.
	 */
	@Override
	public Move getMove() {
		return opponentsLastMove;
	}

	/**
	 * TFT remembers last move that opponent made.
	 * 
	 * @see pl.kaczanowscy.tomek.ipdl.RoundListener#roundEnded(pl.kaczanowscy.tomek.ipdl.RoundResult)
	 */
	@Override
	public void roundEnded(RoundResult result) {
		opponentsLastMove = result.getOpponentMove(this);
	}

}
